<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.model.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.util.*"%>
<%@ page import="javax.persistence.*"%>
<portlet:defineObjects />
<table>
	<tr>
		<td valign="top">
			<table>
				<tr><td><a href='<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="EditIndex"/></portlet:renderURL>'>[发布课程]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="TrainingSubjectCreate"/></portlet:renderURL>'>[授课科目]</a></td></tr>				
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="TrainingAddressCreate"/></portlet:renderURL>'>[授课地点]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="PrivilegeStrategyCreate"/></portlet:renderURL>'>[优惠策略]</a></td></tr>				
				<tr><td><a href='<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="SubscribeOrderView"/></portlet:renderURL>'>[处理订单]</a></td></tr>				
			</table>
		</td>
		<td valign="top">
			<table border="1">
				<tr><td>城市</td><td>订单</td><td>姓名</td><td>电子邮件</td><td>移动电话</td><td>联系电话</td>
				<td>付费</td><td>所选课程</td><td>开始日期</td><td>结束日期</td><td>操作</td></tr>
			<%EntityManager em = EntityManagerHelper.getEntityManager();
			Query q = em.createQuery("select so from SubscribeOrder so");
			List soList = q.getResultList();
			for(Iterator soIt = soList.iterator();soIt.hasNext();){
				Object soObj = soIt.next();
				if((soObj!=null)&&(soObj instanceof SubscribeOrder)){
					SubscribeOrder so = (SubscribeOrder)soObj;%>
<tr><td><a style="color: <%=so.checkColor()%>" title="<%=so.getArrangedCourse().getTrainingAddress().getAddress()%>"><%=so.getArrangedCourse().getTrainingAddress().getCity()%></a></td>
<td><a title="<%=so.checkStatus()%>" style="color: <%=so.checkColor()%>"><%=so.getId()%></a></td>
<td><a style="color: <%=so.checkColor()%>" title='<%=so.getStudentPhone()+"\n"+so.getMobilePhone()%>'><%=so.getStudentName()%></a></td>				
<td style="color: <%=so.checkColor()%>"><%=so.getStudentEmail()%></td>
<td style="color: <%=so.checkColor()%>"><%=so.getMobilePhone()%></td>
<td style="color: <%=so.checkColor()%>"><%=so.getStudentPhone()%></td>
<td><a style="color: <%=so.checkColor()%>" title="原价<%=so.getArrangedCourse().getTrainingSubject().getPrice()%>"><%=so.getActualPrice()%></a></td>
<td><a style="color: <%=so.checkColor()%>" title="<%=so.getArrangedCourse().getTrainingSubject().getPeriod()%>天"><%=so.getArrangedCourse().getTrainingSubject().getCode()%></a></td>
<td style="color: <%=so.checkColor()%>"><%=DataTypeUtil.renderCalender(so.getArrangedCourse().getStartDate())%></td>
<td style="color: <%=so.checkColor()%>"><%=DataTypeUtil.renderCalender(so.getArrangedCourse().getEndDate())%></td>
<td style="color: <%=so.checkColor()%>">
<a href="<portlet:renderURL><portlet:param name="frameworkUri" value="SubscribeOrderEdit"/><portlet:param name="orderId" value="<%=so.getId()+""%>"/></portlet:renderURL>">[修改]</a>
<%if(so.checkStatus().equals(SubscribeOrder.NOT_PAY)){%>
<a href="<portlet:actionURL><portlet:param name="frameworkUri" value="subscribeOrderOperateAction"/><portlet:param name="cmd" value="confirm"/><portlet:param name="orderId" value="<%=so.getId()+""%>"/></portlet:actionURL>">[到款]</a>
<a href="<portlet:actionURL><portlet:param name="frameworkUri" value="subscribeOrderOperateAction"/><portlet:param name="cmd" value="delete"/><portlet:param name="orderId" value="<%=so.getId()+""%>"/></portlet:actionURL>">[删除]</a>
<%}%>
<%if(so.checkStatus().equals(SubscribeOrder.HAVE_PAYED)){%>
<a href="<portlet:actionURL><portlet:param name="frameworkUri" value="subscribeOrderOperateAction"/><portlet:param name="cmd" value="finish"/><portlet:param name="orderId" value="<%=so.getId()+""%>"/></portlet:actionURL>">[完课]</a>
<a href="<portlet:actionURL><portlet:param name="frameworkUri" value="subscribeOrderOperateAction"/><portlet:param name="cmd" value="delete"/><portlet:param name="orderId" value="<%=so.getId()+""%>"/></portlet:actionURL>">[删除]</a>
<%}%>
<%if(so.checkStatus().equals(SubscribeOrder.PASSED)){%>
<a>[---]</a><a href="<portlet:actionURL><portlet:param name="frameworkUri" value="subscribeOrderOperateAction"/><portlet:param name="cmd" value="delete"/><portlet:param name="orderId" value="<%=so.getId()+""%>"/></portlet:actionURL>">[删除]</a>
<%}%>
</td></tr><%}
			}EntityManagerHelper.closeEntityManager();%>
			</table>
		</td>
		<td valign="top">
			<div id="SubscribeOrderForm">

			</div>				
		</td>		
	</tr>
</table>